统计访问对象
from connector.driver import DatabaseDriver

def book_count_by_type(driver: DatabaseDriver):
    # 统计各类别的图书数量
    SQL = '''
    SELECT b.bookTypeName, COUNT(a.id) AS count
    FROM t_book a INNER JOIN t_booktype b
    ON a.bookTypeId = b.id
    GROUP BY a.bookTypeId
    '''
    return driver.query_all(
        'SELECT b.cate_name, COUNT(a.book_id) AS count FROM book a INNER JOIN category b ON a.cate_id = b.cate_id GROUP BY a.cate_id'
    )